# coding=utf-8
"""worldcup URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  url(r'^$', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.conf.urls import url, include
    2. Add a URL to urlpatterns:  url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import url, include
from django.contrib import admin
from django.views.generic import TemplateView
from rest_framework import routers

import worldcup.view as view
import worldcup.views.friendshiplink as friendshiplink_view
import worldcup.views.russianfun as russianfun_view
import worldcup.views.wx_gzh as wx_gzh_view
from worldcup.views import accommodate_view
from worldcup.rest_views import rest_view_demo, user_rest_view, game_rest_view, travel_rest_view, travelevent_rest_view, \
	comment_rest_view, keyword_search_rest_view, wxgzh_rest_view, face_rest_view, config_rest_view, pay_rest_view, \
	spu_rest_view, order_rest_view, shopcart_rest_view, wx_mini_program_rest_view, lottery_rest_view, article_rest_view
from worldcup.views import advice_view
from worldcup.views import wxgroup_view
from worldcup.views.game_view import GameViewSet
from worldcup.views.tracking_view import TrackingViewSet
from worldcup.views.user_view import UserViewSet

# router = routers.DefaultRouter()
# router.register(r'tracking', TrackingViewSet)
# router.register(r'user', UserViewSet)
# router.register(r'game', GameViewSet)

urlpatterns = [
    # url(r'^api/', include(router.urls)),
    # rest demo
    url(r'^restdemo/$', rest_view_demo.demo),

    # ---------------------- rest接口url(前缀用api标识) -------------------
	# jssdk
	url(r'^api/jssdk/sign?$', wxgzh_rest_view.sign),
	url(r'^api/jssdk/access_token?$', wxgzh_rest_view.access_token),
	url(r'^api/jssdk/download?$', wxgzh_rest_view.download),

	# 攻略文章
	url(r'^api/article/list?$', article_rest_view.list_article),
	url(r'^api/article/group?$', article_rest_view.group_article),
	url(r'^api/article/get?$', article_rest_view.get_article),

    # user
    url(r'^api/user/get?$', user_rest_view.get_user),
    url(r'^api/user/remind?$', user_rest_view.get_remind),
	url(r'^api/user/remind/survey?$', user_rest_view.get_remind_survey),
	url(r'^api/user/remind/top?$', user_rest_view.get_remind_top),
	url(r'^api/user/remind/view?$', user_rest_view.get_remind_view),
	url(r'^api/user/remind/dates?$', user_rest_view.get_remind_dates),
	url(r'^api/user/remind/results?$', user_rest_view.get_remind_results),
	url(r'^api/user/address/get?$', user_rest_view.get_address),
	url(r'^api/user/address/update?$', user_rest_view.update_address),
	url(r'^api/advice/add?$', user_rest_view.add_advice),


    # game
    url(r'^api/game/listTeam', game_rest_view.list_team),
    url(r'^api/game/list', game_rest_view.list_game),
    url(r'^api/game/get?$', game_rest_view.get_game),


    # travel
    url(r'^api/travel/haveTravel', travel_rest_view.is_have_travel),
    url(r'^api/travel/insert', travel_rest_view.create_travel),
    url(r'^api/travel/update', travel_rest_view.update_travel),
    url(r'^api/travel/list', travel_rest_view.list_travel),
    url(r'^api/travel/get?$', travel_rest_view.get_travel),

    # 顶
    url(r'^api/travel/support', travelevent_rest_view.support),

    # 约伴
    url(r'^api/travel/date', travelevent_rest_view.date),
    url(r'^api/travel/handleDate', travelevent_rest_view.handle_date),

    # 查看限制
    url(r'^api/travel/remainViewNum?$', travelevent_rest_view.get_remain_view_num),

    #留言板
    url(r'^api/comment/create', comment_rest_view.create_cmt),
    url(r'^api/comment/list?$', comment_rest_view.list_comment),

	# keyword搜索
	url(r'^api/search/keyword/city?$', keyword_search_rest_view.city_search),

	# config
	url(r'^api/config/get?$', config_rest_view.get_config),
	url(r'^api/config/set?$', config_rest_view.set_config),

	# pay
	# url(r'^api/pay/prepay?$', pay_rest_view.prepay),
	url(r'^api/pay/notify?$', pay_rest_view.notify),


	# face
	url(r'^api/face/train?$', face_rest_view.train),
	url(r'^api/face/predict?$', face_rest_view.predict),


	# spu
	url(r'^api/spu/list?$', spu_rest_view.list_spu),
	url(r'^api/spu/get?$', spu_rest_view.get_spu),

	# 转票
	# url(r'^api/spu/saleTicket?$', ticket_rest_view.sale_ticket),

	# order
	url(r'^api/order/create?$', order_rest_view.create_order),
	url(r'^api/order/list?$', order_rest_view.list_order),
	url(r'^api/order/get?$', order_rest_view.get_order),
	url(r'^api/order/refund?$', order_rest_view.refund_order),
	url(r'^api/order/finish?$', order_rest_view.finish_order),
	url(r'^api/order/delete?$', order_rest_view.delete_order),

	#shopcart
	url(r'^api/shopcart/sku/list?$', shopcart_rest_view.shopcart_sku_list),
	url(r'^api/shopcart/sku/count?$', shopcart_rest_view.get_shopcart_num),
	url(r'^api/shopcart/sku/update?$', shopcart_rest_view.add_sku_to_shopcart),
	url(r'^api/shopcart/sku/batchUpdate?$', shopcart_rest_view.batch_add_sku_to_shopcart),
	url(r'^api/shopcart/sku/delete?$', shopcart_rest_view.delete_shopcart),

	# 小程序相关接口
	url(r'^api/mini-program/login?$', wx_mini_program_rest_view.mini_program_login),
	url(r'^api/mini-program/userinfo?$', wx_mini_program_rest_view.mini_program_userinfo),
	url(r'^api/mini-program/prepay?$', wx_mini_program_rest_view.mini_program_pay),
	url(r'^api/mini-program/pay/fail?$', wx_mini_program_rest_view.mini_program_pay_failed),

	# -------------------------------- old ------------------------------
    url(r'^admin/', admin.site.urls),
    url(r'^weixin/$', view.weixin),
    url(r'^index', view.record_showall),
    url(r'^worldcup/$', view.record_showall),
    url(r'^jerseysdemand/$',view.JerseysDemand),

    url(r'^record/update/$', view.record_update),
    url(r'^user/info/$', view.user_info),
    url(r'^user/edit/$', view.user_edit),
    url(r'^user/submit/$', view.user_submit),


    #
    # #record
    # url(r'^record/insert/view/$', record_view.record_insertview),
    # url(r'^record/insert/$', record_view.record_insert),

    # 友情链接
    url(r'^friendship_link', friendshiplink_view.friendshiplink),

    # 俄罗斯玩法
    url(r'^russian_fun/$', russianfun_view.russian_fun),

    # wechat 网页授权
    url(r'^$', view.record_showall),
	url(r'^weixin_logic', wx_gzh_view.auth),
    url(r'^auth/callback/$', wx_gzh_view.auth_callback),

    # 住宿
    url(r'^accommodate/choose', accommodate_view.choose),
    url(r'^accommodate/hotel/form', accommodate_view.hotel_form),

    # 微信群
    url(r'^wxgroup/$', wxgroup_view.view),

    #advice
    url(r'^advice/$', advice_view.view),
    url(r'^advice/add$', advice_view.add),
    url(r'^advice/list$', advice_view.list,name='advice_list'),

	url(r'^api/lottery?$',lottery_rest_view.lottery),

    url(r'^MP_verify_2DOocfxi9zSGM8l2.txt/$', TemplateView.as_view(template_name='MP_verify_2DOocfxi9zSGM8l2.txt',
                                                 content_type='text')),
]
